package br.mil.eb.pqrmnt7.scc.facade;

import java.util.Date;
import java.util.List;

import javax.inject.Inject;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import br.mil.eb.pqrmnt7.scc.entity.TipoCombustivel;
import br.mil.eb.pqrmnt7.scc.entity.controleabastecimento.CalculoSaldoCombustivelException;
import br.mil.eb.pqrmnt7.scc.entity.controleabastecimento.LinhaControleSaldoCombustivel;
import br.mil.eb.pqrmnt7.scc.model.controleabastecimento.CalculaSaldoCombustivel;

public class SaldoCombustivelImpl implements ISaldoCombustivel {

	private static final long serialVersionUID = 1L;

	private static final Log logger = LogFactory.getLog(SaldoCombustivelImpl.class);
	
	@Inject
	CalculaSaldoCombustivel calculaSaldo;
	
	@Override
	public Long calculaSaldo(TipoCombustivel tipoCombustivel, Date anoMesReferencia) throws CalculoSaldoCombustivelException {
		logger.debug("Chamado o calcula saldo da classe " + getClass().getCanonicalName());
		return calculaSaldo.calculaSaldoCombustivel(tipoCombustivel, anoMesReferencia);
	}

	@Override
	public Long calculaSaldo(TipoCombustivel tipoCombustivel, Date dataInicio, Date dataFim)
			throws CalculoSaldoCombustivelException {
		logger.debug("Chamado o calcula saldo da classe " + getClass().getCanonicalName());
		logger.debug("TipoCombustivel: " + tipoCombustivel);
		logger.debug("dataInicio: " + dataInicio);
		logger.debug("dataFim: " + dataFim);
		return calculaSaldo.calculaSaldoCombustivel(tipoCombustivel, dataInicio, dataFim);
	}
	
	@Override
	public List<LinhaControleSaldoCombustivel> recuperaRegistrosDeControle(	Date dataInicio, Date dataFim) {
		logger.debug("Chamado o recuperaRegistrosDeControle da classe " + getClass().getCanonicalName());
		logger.debug("dataInicio: " + dataInicio);
		logger.debug("dataFim: " + dataFim);
		return calculaSaldo.recuperaRegistrosDeControle(dataInicio, dataFim);
	}

	@Override
	public List<LinhaControleSaldoCombustivel> recuperaRegistrosDeControle(
			TipoCombustivel tipoCombustivel, Date dataInicio, Date dataFim) {
		return calculaSaldo.recuperaRegistrosDeControle(tipoCombustivel, dataInicio, dataFim);
	}

}
